<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.jxc.model.vo.SessionInfo"%>
<%@page import="com.jxc.util.ResourceUtil"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
	SessionInfo sessionInfo = (SessionInfo)request.getSession().getAttribute(ResourceUtil.getSessionInfoName());
	request.setAttribute("type",sessionInfo.getType());
%>

<script type="text/javascript">
	function showsale(){
		var discount = $('#goodsForm').find('input[name=discountNum]').val();
		var showPrice = $('#goodsForm').find('input[name=showPrice]').val();
		var salePrice  = $('#goodsForm').find('input[name=salePrice]').val();	
		if(discount!=null){
			if(showPrice>0){
				$('#goodsForm').find('input[name=salePrice]').val(parseFloat(discount*0.1*showPrice).toFixed(2));
			}else{
				$('#goodsForm').find('input[name=salePrice]').val(0);
			}
		}else{
			$('#goodsForm').find('input[name=salePrice]').val(parseFloat(showPrice).toFixed(2));
		}
	}
	var type=${type};
	
</script>

<div style="padding: 5px;">
	<form id="goodsForm" method="post">
		<input name="id" type="hidden" />
		<table class="tableForm">
			<tr>
				<th style="width: 80px;">商品条码</th>
				
				<s:if test="#request.type==1||#request.type==2||#request.type==5">
					<td><input name="barcode" class="easyui-validatebox" data-options="required:'true',missingMessage:'请填写款号/款式'" /></td>
				</s:if>
				<s:else>
					<td><input name="barcode" readonly="readonly"/></td>
				</s:else>
				
				<th style="width: 80px;">款&nbsp;&nbsp;&nbsp;&nbsp;号</th>
				<td><input name="type" class="easyui-validatebox" data-options="required:'true',missingMessage:'请填写款号/款式'" /></td>
				<th style="width: 80px;">商品名称</th>
				<td><input name="name" class="easyui-validatebox" data-options="required:'true',missingMessage:'请填写商品名称'" /></td>
			</tr>
			<tr>
				<th>品&nbsp;&nbsp;&nbsp;&nbsp;牌</th>
				<td><input name="bid"  style="width: 145px;"  data-options="required:'true',missingMessage:'请选择品牌'"/></td>
				<th>商品类别</th>
				<td><input name="gtid" style="width: 145px;" data-options="required:'true',missingMessage:'请选择商品类别'" /></td>
				<th>颜&nbsp;&nbsp;&nbsp;&nbsp;色</th>
				<td><input name="color"/></td>
			</tr>
			<tr>
				<th>尺&nbsp;&nbsp;&nbsp;&nbsp;码</th> 
				<td><input name="size" style="width: 145px;"/></td>
				<th>单&nbsp;&nbsp;&nbsp;&nbsp;位</th> 
				<td><input name="unit" style="width: 145px;" class="easyui-validatebox" data-options="required:'true',missingMessage:'请填写单位'"/></td>
				<th>吊&nbsp;牌&nbsp;价</th> 
				<td><input name="showPrice" style="width: 145px;"  onblur="showsale()" class="easyui-validatebox" data-options="required:'true',missingMessage:'请填写吊牌价'"/></td>
			</tr>
			<tr>
				<th>进&nbsp;&nbsp;&nbsp;&nbsp;价</th> 
				<td><input name="buyPrice" style="width: 145px;" class="easyui-validatebox" data-options="required:'true',missingMessage:'请填写进价'"/></td>
				<th>备&nbsp;&nbsp;&nbsp;&nbsp;注</th>
				<td colspan="5"><input name="remark" class="easyui-validatebox" /></td>
				<input name="did" type="hidden" />
		</table>
	</form>
</div>